{template "member","header"}
<script type="text/javascript" src="images/js/validator.js"></script>
<div id="main">
{template "member","left"}
<div id="right">
  <p id="position"> <strong>当前位置：</strong><a href="{$M[url]}index.php">会员中心</a>修改密码</p>
  <form action="{$M[url]}editpwd.php" method="post" name="myform">
    <table cellpadding="0" cellspacing="1" class="table_form">
    <caption>修改密码</caption>
      <tr>
        <th width="20%">用户名：</th>
        <td width="80%"><strong>{$username}</strong></td>
      </tr>
      <tr>
        <th>原密码：</th>
        <td><input name="old_password" type="password" id="old_password" size="15" require="true" datatype="limit" min="6" max="16" msg="密码不得少于6个字符或超过16个字符！" /></td>
      </tr>
      <tr>
        <th>新密码：</th>
        <td><input name="new_password" type="password" id="new_password" size="15" require="true" datatype="limit" min="6" max="16" msg="密码不得少于6个字符或超过16个字符！" /></td>
      </tr>
      <tr>
        <th>密码强度：</th>
        <td><div id="pw_check_1" class="pw_check" style="display:none;"><span><strong class="c_orange">弱</strong></span><span>中</span><span>强</span></div>
          <div id="pw_check_2" class="pw_check" style="display:none;"><span>弱</span><span><strong class="c_orange">中</strong></span><span>强</span></div>
          <div id="pw_check_3" class="pw_check" style="display:none;"><span>弱</span><span>中</span><span><strong class="c_orange">强</strong></span></div></td>
      </tr>
      <tr>
        <th>确认新密码：</th>
        <td><input name="chk_password" type="password" id="chk_password" size="15" require="true" datatype="limit|repeat"  min="6" max="16" to="new_password" msg="密码不得少于6个字符或超过16个字符|两次输入的密码不一致" /></td>
      </tr>
      <tr>
		<input type="hidden" name="forward" value="{$forward}" />
        <input type="hidden" name="username" value="{$username}" />
        <th></th>
        <td colspan="2"><label>
          <input type="submit" name="dosubmit" value="确 定" id="button" />
          &nbsp;
          <input type="reset" name="reset" value="重 置" />
          </label></td>
      </tr>
    </table>
  </form>
</div>
</div>
{template "member","footer"}
<script language="javascript">
$().ready(function() {
	$('form').checkForm(1);
});
	
	
function CharMode(iN)
{
if (iN>=65 && iN <= 90)
return 2;
if (iN>=97 && iN <= 122)
return 4;
else
return 1;
}

function bitTotal(num)
{
modes = 0;
for(i=0; i<3; i++)
{
if (num & 1) modes++;
num >>>= 1;
}
return modes;
}

function checkStrong(sPW){
Modes=0;

for (i=0;i<sPW.length;i++){
Modes|=CharMode(sPW.charCodeAt(i));
}
var btotal = bitTotal(Modes);
if (sPW.length >= 10) btotal++;
switch(btotal) {
case 1:
return "pw_check_1";
break;
case 2:
return "pw_check_2";
break;
case 3:
return "pw_check_3";
break;
default:
return "pw_check_1";
}
}

function ShowStrong(){
data = checkStrong($('#new_password').val());
pw_id = '#' + data;
$(".pw_check").hide();
$(pw_id).show();
}

$('#new_password').blur(function(){
	 ShowStrong();
});
</script>
